<template>
	<div class="desk">
	
		<div class="deskhome">
			<deskleft :roomListObj="showRoomList" class="deskleft"></deskleft>
			<div class="deskcenter">
				<div :style="{width:hotelInventories.length*100+'px'}">
					<deskheader :hotelInventories="hotelInventories"></deskheader>
					<deskcalendar :roomList="roomList"  :hotelInventories="hotelInventories" :stayInfo="stayInfo" :getCloseRoomsList="getCloseRoomsList" :style="{width:hotelInventories.length*100+'px'}" ></deskcalendar>
				</div>
			</div>
		
		</div>
	<deskfooter class="deskfooter"></deskfooter>
	</div>
</template>
<script>
 import { mapGetters ,mapActions} from 'Vuex'
 import deskfooter from './_parts/deskfooter.vue';
 import deskleft from './_parts/deskleft.vue';
 import deskheader from  './_parts/deskheader.vue';
  import deskcalendar from  './_parts/deskcalendar.vue';
import './desk.less';
	export default{
		name:"desk",
		data(){
			return {
				roomList:[],
				hotelInventories:[],
				getCloseRoomsList:[],
				stayInfo:[]
// <deskheader class="deskheader"></deskheader>
			}
		},
		methods:{
			...mapActions(['getRoomLIst','getHotelInventories','getCloseRooms','getStayInfo']),
		},
		computed:{
			showRoomList(){
				if(this.roomList.length>0){
					let res=[];
					let roomList=this.roomList;
					let s={}
					let zz=[];
					for(let i=0;i<roomList.length;i++){
						
						if(!res.includes( roomList[i].roomTypeName)){
							res.push(roomList[i].roomTypeName);
							let sz=[];
							s[roomList[i].roomTypeName]=[roomList[i]];
						}else{
							s[roomList[i].roomTypeName].push(roomList[i])
						}
					//	this.roomListObj=s
						
					}
					//this.roomListObj=s
					return s
				}else{
					return {}
				}
			}
		},
		mounted:function(){

		},
		watch:{

		},
		destroyed:function(){

		},
		created(){
			let vm=this
			this.getRoomLIst().then(res=>{
				if(res.code==0){
					vm.roomList=res.data
				}
			});
			this.getHotelInventories().then(res=>{
				vm.hotelInventories=res.data.hotelInventoriesList
			});
			this.getCloseRooms().then(res=>{
				vm.getCloseRoomsList=res.data
			});
			this.getStayInfo().then(res=>{
				vm.stayInfo=res.data.stayList
			})
		},
		components:{
			deskfooter,
			deskheader,
			deskleft,
			deskcalendar
		}
	}
</script>

<style scoped lang="less">
	
</style>